// slice splice
const { log } = console

let array = [1, 2, 3, 4, 5]
// 纯函数
// [ 1, 2, 3 ] 只能取到 0 1 2
log(array.slice(0, 3))
log(array.slice(0, 3))
log(array.slice(0, 3))
// [ 1, 2, 3 ]
// [ 1, 2, 3 ]
// [ 1, 2, 3 ]

// 不纯的函数
log(array.splice(0, 3))
log(array.splice(0, 3))
log(array.splice(0, 3))
// [ 1, 2, 3 ]
// [ 4, 5 ]
// []

// 纯函数 求和
const getSum = (n1, n2) => {
  return n1 + n2
}
log(getSum(1, 2))
log(getSum(1, 2))
log(getSum(1, 2))
log(getSum(1, 2))
// 3 3 3 3 纯函数!
